package sctu.edu.java.year2016.team06.chenqiang.day20160522.chapter5_2;

/**
 * Created by XQ on 2016/5/22.
 * 编写java程序，将数组中最大的数输出。
 */

import java.util.Scanner;

public class Chapter5_2 {
    public static void main(String[] args) {
        int arr[] = new int[100];
        System.out.println("请输入你要录入数组的5个数据：");
        Scanner scan = new Scanner(System.in);
        for (int i = 0; i <= 4; i++) {
            int x = scan.nextInt();
            arr[i] = x;
        }
        System.out.println("此数组的数据有：");
        for (int i = 0; i <= 4; i++) {
            System.out.print(arr[i] + "\t");
        }
        System.out.println("\n数组中最大的数是：");
        int max = arr[0];
        for (int i = 1; i <= 4; i++) {
            if (max < arr[i]) {
                max = arr[i];
            }
        }
        System.out.println(+max);
    }

}